SSH Access
You can connect to the shell of your compute resources over SSH. This is helpful for development, troubleshooting and testing.
ssh -t cgc@cgc-api.comtegra.cloud -p 2222 RESOURCE [COMMAND]
It will run [COMMAND] in the default container of RESOURCE.
If you don't specify the command, by default it will be /bin/sh
.
If you'd like to connect to the container of a running job, add job/
before
the resource name like this.
ssh -t cgc@cgc-api.comtegra.cloud -p 2222 job/RESOURCE [COMMAND]
Rsync file synchronization​
You can use rsync to sync your files from/to your containers
rsync -e 'ssh -p 2222' --rsync-path 'RESOURCE rsync' SRC cgc@cgc-api.comtegra.cloud:DST
Configuration​
The only way to authenticate is via a key, so the first step is to generate one.
- Linux
- Windows
mkdir -p ~/.ssh/keys
ssh-keygen -f ~/.ssh/keys/cgc
mkdir -p ~\.ssh\keys
ssh-keygen -f ~\.ssh\keys\cgc
By default, this command will ask for a new password. You'll have to provide this password each time you use the key. This is because otherwise anyone that gets hold of your key file would be able to run arbitrary commands on your behalf.
You may press ENTER without providing a password or add -N ''
to the above
command to skip adding the key password.
Then, configure your SSH client to use this key automatically when authenticating to CGC.
- Linux
- Windows
echo "
Host cgc-api.comtegra.cloud
IdentityFile ~/.ssh/keys/cgc
" >> ~/.ssh/config
In Windows you have to do additional steps due to file encoding.
Please check if you have any content in .ssh\config
file already as this set of commands would erase it.
You can use notepad ~\.ssh\config
.
echo "
Host cgc-api.comtegra.cloud
IdentityFile ~/.ssh/keys/cgc
" >> ~\.ssh\config_temp
(Get-Content ~\.ssh\config_temp) | Out-File -Encoding UTF8 ~\.ssh\config
rm ~\.ssh\config_temp
Next, add this key to your CGC account.
SSH keys are unique cluster wide. You can not use the same key for few namespaces
- Linux
- Windows
cgc keys ssh create -pk "$(cat ~/.ssh/keys/cgc.pub)"
cgc keys ssh create -pk "$(cat ~\.ssh\keys\cgc.pub)"
Now you should be able to log into your compute resources.
ssh -t cgc@cgc-api.comtegra.cloud -p 2222 RESOURCE-NAME [COMMAND]